def s(r):
    a = []
    c = ["(", "[", "{", "<"]
    v = [")", "]", "}", ">"]
    z = {")": "(", "]": "[", "}": "{", ">": "<"}
    for b in r:
        if b in c:
            a.append(b)
        elif b in v:
            if not a:
                return "False"
            if a[-1] == z[b]:
                a.pop()
            else:
                return "False"
    if not a:
        return "True"
    else:
        return "False"
r = input("Введите порядок скобок")
d = s(r)
print(d)
